cmake_minimum_required(VERSION 3.10)

set(TARGET cpp_rust_demo)
project(${TARGET})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../rust_lib_demo/include")

aux_source_directory(src SOURCE_DIR)

add_executable(${TARGET} ${SOURCE_DIR})

message("Current architecture: ${CMAKE_SYSTEM_PROCESSOR}")

if(APPLE)
    set(DYLIB_SUFFIX "dylib")
elseif(UNIX)
    set(DYLIB_SUFFIX "so")
endif()

target_link_libraries(${TARGET} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../rust_lib_demo/libs/${CMAKE_SYSTEM_PROCESSOR}/librust_lib_demo.${DYLIB_SUFFIX}")
